/*数组遍历 */
const array=[1,2,3,4,5,6,7,8,9,0]
var len=array.length
/*面向机器 o(n)*/
for(let i=0;i<len;i++){
    console.log("index:"+i+"|"+"item:"+array[i]);
  
}
console.log();
/*es6 可读性高 */
var i=0
for(let item of array){
    
    console.log("index:"+i+"|"+"item:"+item);
    i++
  
}
console.log();
array.forEach((item,index) => {
    console.log("index:"+index+"|"+"item:"+item);
    
});
console.log();
array.map((item,index)=>{
    console.log(index,item);
    return item+1

})
console.log();
console.log(array.map((item,index)=>{
    console.log(index,item);
    return item+1

}));


